package com.bourse.dbfeeder.constants;

public enum IndiceConstants {

	CAC40("FR0003500008","Cac 40","Cac40"),
	SBF120("FR0003999481","Sbf 120","Sbf120"),
	CAC_ALL_TRADABLE("FR0003999499","Cac all tradable","CacAllTradable"),
	CAC_SMALL("QS0010989125","Cac small", "CacSmall"),
	CAC_MID_60("QS0010989117","Cac mid 60", "CacMid60"), 
	CAC_MID_N_SMALL("QS0010989133","Cac mid and small", "CacMidAndSmall"),
		
	INDICES("INDICE","Indices","Indices");
	
	
	private final String isin;
	
	private final String name;
	
	private final String histoDirName;
	
	private IndiceConstants(String isin, String name, String histoDirName){
		this.isin = isin;
		this.name= name;
		this.histoDirName = histoDirName;
	}
	
	/**
	 * Return the isin
	 * @return
	 */
	public String getIsin(){
		return isin;
	}
	
	/**
	 * Return the name
	 * @return
	 */
	public String getName(){
		return this.name;
	}
	
	/**
	 * Return the directory name where is stored the index datas 
	 * @return
	 */
	public String getHistoDirName(){
		return this.histoDirName;
	}

	
	/**
	 * Get IndiceConstant from its dir path
	 * @param histoDirName
	 * @return
	 */
	public static IndiceConstants fromHistoDirName(String histoDirName){
		IndiceConstants[] list = IndiceConstants.values();
		for(IndiceConstants indiceConstante : list){
			if(indiceConstante.getHistoDirName().equals(histoDirName)){
				return indiceConstante;
			}
		}
		return null;
	}
	
}


//http://ichart.finance.yahoo.com/table.csv?s=FR0003500008&amp;a=02&amp;b=1&amp;c=2011&amp;d=08&amp;e=18&amp;f=2011&amp;g=d&amp;ignore=.csv"
//http://ichart.finance.yahoo.com/table.csv?s=PX4.PA&amp;a=02&amp;b=1&amp;c=2011&amp;d=08&amp;e=18&amp;f=2011&amp;g=d&amp;ignore=.csv
